package com.eliza.library.dao

import android.content.Context
import androidx.lifecycle.LiveData
import androidx.room.*
import com.eliza.library.model.Contactor


/*-*- coding:utf-8 -*-
 * @Author  : debi
 * @Time    : 5/1/22
 * @Software: Android Condio
 */

class ContactorRepository  {
     val contactorDao: ContactorDao

    constructor(context: Context) {
        val database: ContactorDatabase = ContactorDatabase.getInstance(context)
        contactorDao = database.contactorDao
    }
    suspend fun insertCon(vararg students: Contactor) {
        contactorDao.insertCon(*students as Array<out Contactor>)
    }

    suspend fun deleteCon(vararg students: Contactor) {
        contactorDao.deleteCon(*students as Array<out Contactor>)
    }

    suspend fun updateCon(vararg students: Contactor) {
        contactorDao.updateCon(*students as Array<out Contactor>)
    }

    val getAllConList: LiveData<List<Contactor>>
        get() = contactorDao.getAllConList()
}